package com.bz.portal.feign;

import com.bz.pojo.TbItem;
import com.bz.pojo.TbItemDesc;
import com.bz.pojo.TbItemParamItem;
import com.bz.portal.feign.fallback.CommonRedisFeignClientFallbackFactory;
import com.bz.vo.CatVo;
import com.bz.vo.ContentVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 命令规范: 服务名称 + FeignClient
 */
@FeignClient(value = "common-redis",fallbackFactory = CommonRedisFeignClientFallbackFactory.class)
public interface CommonRedisFeignClient {

    //--------------------------- /redis/itemCategory --------------------------
    /**
     * 向Redis中添加缓存数据
     * @return
     */
    @GetMapping("/redis/itemCategory/insertItemCategory")
    CatVo insertItemCategory(@RequestBody CatVo catVo);

    /**
     * 查询Redis中缓存的首页商品分类
     * @return
     */
    @GetMapping("/redis/itemCategory/selectItemCategory")
    CatVo selectItemCategory();

    /**
     * 将大广告位的数据添加到缓存中
     * @return
     */
    @PostMapping("/redis/content/insertContentAD")
    void insertContentAD(@RequestBody List<ContentVo> contentVoList);

    //--------------------------- /redis/content --------------------------
    /**
     *查询缓存中首页大广告位的数据
     * @return
     */
    @GetMapping("/redis/content/selectContentAD")
    List<ContentVo> selectContentAD();

    //--------------------------- /redis/item --------------------------
    /**
     *缓存商品基本信息
     * @param tbItem
     */
    @GetMapping("/redis/item/insertItemBasicInfo")
    void insertItemBasicInfo(@RequestBody TbItem tbItem);

    /**
     * 查询缓存中的商品基本信息
     * @return
     */
    @GetMapping("/redis/item/selectItemBasicInfo")
    TbItem selectItemBasicInfo(@RequestParam("tbItemId") Long tbItemId);

    /**
     * 添加缓存商品介绍信息
     * @param tbItemDesc
     */
    @PostMapping("/redis/item/insertItemDesc")
    void insertItemDesc(@RequestBody TbItemDesc tbItemDesc);

    /**
     * 查询缓存中的商品介绍
     * @return
     */
    @GetMapping("/redis/item/selectItemDesc")
    TbItemDesc selectItemDesc(@RequestParam("tbItemId") Long tbItemId);

    /**
     *添加缓存商品的规格参数
     * @param tbItemParamItem
     */
    @PostMapping("/redis/item/insertItemParamItem")
    void insertItemParamItem(@RequestBody TbItemParamItem tbItemParamItem);

    /**
     *查询缓存中的商品规格参数
     * @return
     */
    @GetMapping("/redis/item/selectItemParamItem")
    TbItemParamItem selectItemParamItem(@RequestParam("tbItemId") Long tbItemId);
}
